{% extends "../base.html" %}
{% block content %}
{% macro buttonView(name,position,color,gcode,confirmText,cond,html) %}
<tr>
	<td>
		<input name="Name" value="{{name}}" class="form-control name">
		<select name="Color" class="form-control">
			<option value="btn btn-success" {% if color=="btn btn-success" %}selected{% endif %} translate>Green</option>
			<option value="btn btn-info" {% if color=="btn btn-info" %}selected{% endif %} translate>Blue</option>
			<option value="btn btn-warning" {% if color=="btn btn-warning" %}selected{% endif %} translate>Orange</option>
			<option value="btn btn-danger" {% if color=="btn btn-danger" %}selected{% endif %} translate>Red</option>
		</select>
	</td>
	<td>
		<select name="Position" class="form-control">
			<option value="/" {% if position=="/" %}selected{% endif %} translate>Dashboard</option>
			<option value="/z-calibration" {% if position=="/z-calibration" %}selected{% endif %} translate>Z-Axis Calibration</option>
			<option value="/projector-calibration" {% if position=="/projector-calibration" %}selected{% endif %} translate>Projector Calibration</option>
		</select>
		<select name="Condition" class="form-control">
			<option value="" {% if cond=="" %}selected{% endif %} translate>Anytime</option>
			<option value="idle-obj" {% if cond=="idle-obj" %}selected{% endif %} translate>Idle</option>
			<option value="printing-obj" {% if cond=="printing-obj" %}selected{% endif %} translate>Printing</option>
			<option value="hidden" {% if cond=="hidden" %}selected{% endif %} translate>Hidden</option>
		</select>
		<input name="ConfirmText" value="{{confirmText}}" placeholder="Optional confirmation dialog text" class="form-control">
	</td>
	<td><textarea name="Gcode" class="form-control">{{gcode}}</textarea></td>
	<td><textarea name="HTML" class="form-control">{{html}}</textarea></td>
	<td class="action"><a href="#" class="up">&#x2B06;</a><br><a href="#" class="down">&#x2B07;</a><br><a href="#" class="remove">&#x2716;</a></td>
</tr>
{% endmacro %}
<form action="" method="post" id="buttons" class="edit-page edit-table">
	<div class="row">
		<div class="col-md-12">
			<table class="table-striped">
				<tr class="thead">
					<th translate>Name / Color</th>
					<th translate>Position / Condition / Confirmation</th>
					<th translate>Gcode</th>
					<th translate>Custom HTML</th>
					<th translate>Action</th>
				</tr>
				{% if buttons %}
					{% for button in buttons %}
						{{ buttonView(button.Name,button.Position,button.Color,button.Gcode,button.ConfirmText,button.Condition,button.HTML) }}
					{% endfor %}
				{% endif %}
				{{ buttonView("",0,0,"","","") }}
			</table>
			<br>
			<button type="submit" class="btn btn-success">Submit</button>
		</div>
	</div>
</form>
{% endblock %}
